{extend name="admin/base" /}
{block name="resources"/}
<link rel="stylesheet" type="text/css" href="ADMIN_CSS/defau.css">
<script src="ADMIN_JS/art_dialog.source.js"></script>
<script src="ADMIN_JS/iframe_tools.source.js"></script>
<script src="ADMIN_JS/material_managedialog.js"></script>
{/block}
{block name="main"}
<div class="set-style">
	<dl>
		<dt>版权logo：</dt>
		<dd>
			<div class="class-logo">
				<p>
					<img id="imglogo" src="__ROOT__/{$info.copyright_logo}">
				</p>
			</div>
			<div class="ncsc-upload-btn">
				<a href="javascript:void(0);">
					<span>
						<input hidefocus="true" size="1" class="input-file" name="file_upload" id="uploadImg" type="file" onchange="imgUpload(this);">
						<input type="hidden" id="logo" value="{$info.copyright_logo}" />
					</span>
					<p><i class="fa fa-cloud-upload text"></i>上传图片</p>
				</a>
			</div>
			<p class="hint">
				<br><span style="color: orange;">建议使用宽280像素-高50像素内的GIF或PNG透明图片， 该功能只针对授权用户有效；点击下方"提交"按钮后生效。</span>
			</p>
		</dd>
	</dl>
	<dl>
		<dt>备案号：</dt>
		<dd>
			<input id="meta" type="text"  value="{$info.copyright_meta}" class="input-common" />
<!-- 			<p class="hint">Keywords项出现在页面头部的标签中，用于记录本页面的关键字，多个关键字请用分隔符分隔</p> -->
		</dd>
	</dl>
	<dl>
		<dt>公司名称：</dt>
		<dd>
			<input id="companyname" type="text" value="{$info.copyright_companyname}" class="input-common" />
<!-- 			<p class="hint">Description出现在页面头部的Meta标签中，用于记录本页面的摘要与描述，建议不超过80个字</p> -->
		</dd>
	</dl>
	<dl>
		<dt>版权链接：</dt>
		<dd>
			<input id="link" type="text"  value="{$info.copyright_link}" class="input-common" />
<!-- 			<p class="hint">Keywords项出现在页面头部的标签中，用于记录本页面的关键字，多个关键字请用分隔符分隔</p> -->
		</dd>
	</dl>	
	<dl>
		<dt>版权信息：</dt>
		<dd>
			<textarea id="desc" class="textarea input-common" maxlength="50">{$info.copyright_desc}</textarea>
<!-- 			<p class="hint">如需在中添加其他的HTML代码，可以使用本设置，否则请留空</p> -->
		</dd>
	</dl>
	<button class="edit_button" onclick="setConfigAjax();">提交</button>
</div>
<script src="ADMIN_JS/ajax_file_upload.js" type="text/javascript"></script>
<script src="__STATIC__/js/file_upload.js" type="text/javascript"></script>
<script>
//图片上传
function imgUpload(event) {
	var fileid = $(event).attr("id");
	var data = { 'file_path' : UPLOADCOMMON };
	var id = $(event).next().attr("id");
	uploadFile(fileid,data,function(res){
		if(res.code){
			$("#img"+id).attr("src","__UPLOAD__/"+res.data);
			$("#"+id).val(res.data);
			showTip(res.message,"success");
		}else{
			showTip(res.message,"error");
		}
	});
}
	function setConfigAjax(){
		var Logo = $("#logo").val();
		var meta = $("#meta").val();
		var link = $("#link").val();
		var desc = $("#desc").val();
		var companyname = $("#companyname").val();
		$.ajax({
			type:"post",
			url : "{:__URL('ADMIN_MAIN/config/copyrightinfo')}",
			async : true,
			data : {
				"copyright_logo" : Logo,
				"copyright_meta" : meta,
				'copyright_link' : link,
				"copyright_desc" : desc,
				"copyright_companyname" : companyname
			},
			success : function(data){
				if(data['code'] > 0)
					{
						showMessage('success', data["message"]);
						location.href=__URL("ADMIN_MAIN/config/copyrightinfo");
					}else{
						showMessage('error', data["message"]);
					}
			}
		})
	}
</script>
{/block}